home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / GRID.INC < prev    next >
Text File  |  1993-05-18  |  7KB  |  271 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file exports definitions that create a block menu look and
  5. feel. This is one of several look and feel files that export the same
  6. procedures.
  7.  
  8. Useful Routines Exported:
  9.  
  10. LookSetup
  11.    Call this to initialize the screen. Set MenuTitle and StatusLineText
  12.    before calling this routine.
  13.  
  14. CornerStretchBox (Header,Col,Row)
  15.    Creates a window from the array Choices with the upper left corner at
  16.    Row/Col. LastKey is set to the letter that is chosen.
  17.  
  18. CenterStretchBox (Header,Col,Row)
  19.    Creates a window from the array Choices with the center at Row/Col.
  20.    if a 0 is passed for either the Row or Col then the center of the
  21.    screen is assumed. LastKey is set to the letter that is chosen.
  22.  
  23. Leave
  24.    Puts up an exit box.
  25.  
  26.  
  27. ==========================================================
  28. EndComment
  29.  
  30.  
  31. var
  32.   Grid1 = "╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣"
  33.   Grid2 = "├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤"
  34.   Grid3 = "╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣"
  35.   Grid4 = "├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤"
  36.   Choices
  37.   MenuTitle
  38.   StatusLineText
  39.   StatusWindow
  40.   HeightDifference
  41.   Greek = False
  42.  
  43. var
  44.   BackGroundFG
  45.   BackGroundBG
  46.   TitleBoxBorderFG
  47.   TitleBoxBG
  48.   TitleBoxInsideFG
  49.   ClockColorFG
  50.   StatusLineFG
  51.   StatusLineBG
  52.   MenuInsideFG
  53.   MenuBG
  54.   MenuHeaderFG
  55.   MenuHeaderBG
  56.   MenuBorderFG
  57.   MenuVertLinesFG
  58.   MenuInverseFG
  59.   MenuInverseBG
  60.   MenuCapColorFG
  61.   ConsoleInsideFG
  62.   GreekFG
  63.   GreekBG
  64.  
  65. ;------ This is where you set your favorite colors.
  66.  
  67. Procedure SetColors
  68.    if ColorScreen
  69.       BackGroundFG     = LBlue
  70.       BackGroundBG     = Black
  71.       TitleBoxBG       = Brown
  72.       TitleBoxBorderFG = White
  73.       TitleBoxInsideFG = Yellow
  74.       ClockColorFG     = Yellow
  75.       StatusLineFG     = Yellow
  76.       StatusLineBG     = Mag
  77.       MenuBG           = Black
  78.       MenuInsideFG     = Yellow
  79.       MenuBorderFG     = LRed
  80.       MenuHeaderFG     = White
  81.       MenuHeaderBG     = Green
  82.       MenuVertLinesFG  = LGreen
  83.       MenuInverseFG    = Yellow
  84.       MenuInverseBG    = Mag
  85.       MenuCapColorFG   = White
  86.       ConsoleInsideFG  = White
  87.       GreekFG          = Black
  88.       GreekBG          = Brown
  89.    else
  90.       BackGroundFG     = Grey
  91.       BackGroundBG     = Black
  92.       TitleBoxBG       = Grey
  93.       TitleBoxBorderFG = Black
  94.       TitleBoxInsideFG = Black
  95.       ClockColorFG     = Black
  96.       StatusLineFG     = Black
  97.       StatusLineBG     = Grey
  98.       MenuBG           = Black
  99.       MenuInsideFG     = Grey
  100.       MenuBorderFG     = White
  101.       MenuHeaderFG     = Black
  102.       MenuHeaderBG     = Grey
  103.       MenuVertLinesFG  = White
  104.       MenuInverseFG    = Black
  105.       MenuInverseBG    = Grey
  106.       MenuCapColorFG   = White
  107.       ConsoleInsideFG  = Grey
  108.       GreekFG          = Black
  109.       GreekBG          = Grey
  110.    endif
  111. EndProc
  112.  
  113. ;------ Sets up main window to block look.
  114.  
  115. Procedure LookSetup
  116.    if MenuInsideFG = 0 then SetColors
  117.    NoExit
  118.  
  119.    ;------ Clear the screen with a textured background
  120.  
  121.    if not Overlayed
  122.       TextColor BackGroundFG BackGroundBG
  123.       ClearScreen
  124.       GotoXY 1 3
  125.       loop ScreenHeight - 3
  126.          Writeln Grid3
  127.       endloop
  128.    endif
  129.  
  130.    ;------ Draw Status Line
  131.  
  132.    NoBoxBorder
  133.    InactiveBox NoBoxBorder
  134.    Explode Off
  135.    BoxInsideColor StatusLineFG StatusLineBG
  136.    DrawBox 1 ScreenHeight ScreenWidth 1
  137.    StatusWindow = CurrentWindow
  138.    WriteCenter(StatusLineText)
  139.  
  140.    if not Overlayed
  141.  
  142.       ;------ Draw the Title Box
  143.  
  144.       SingleLineBox
  145.       BoxInsideColor TitleBoxInsideFG TitleBoxBG
  146.       BoxBorderColor TitleBoxBorderFG TitleBoxBG
  147.       DrawBox 1 1 ScreenWidth 3
  148.       GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)
  149.       Write MenuTitle
  150.  
  151.       ;------ Display the clock
  152.  
  153.       ClockColor ClockColorFG TitleBoxBG
  154.       ClockPos 3 2
  155.  
  156.       ;------ Setup Console
  157.  
  158.       ConsolePos 42 5
  159.       ConsoleHeaderColor MenuInverseFG MenuInverseBG
  160.       ConsoleInsideColor ConsoleInsideFG MenuBG
  161.  
  162.    endif
  163.    BoxHeaderColor MenuHeaderFG MenuHeaderBG
  164.    HeightDifference = 2
  165.    SmallShadow
  166.    Shadow
  167. EndProc
  168.  
  169.  
  170. Procedure MakeBox(Header,Col,Row,Center)
  171. var NumElem Height Width Cnt
  172.  
  173.    Width = Length(Header) + 1
  174.    NumElem = NumberOfElements(Choices)
  175.  
  176.      ;Get the widest element in the Choices Array
  177.  
  178.    if Length(Choices[1]) > 0
  179.       Cnt = 65
  180.       loop NumElem
  181.          Trim(Choices[LoopIndex])
  182.          if left(Choices[LoopIndex],1) <> '─'
  183.             Choices[LoopIndex] = " " + Char(Cnt) + ". " + Choices[LoopIndex]
  184.             Cnt = Cnt + 1
  185.          endif
  186.          Width = Max(Width,Length(Choices[LoopIndex]))
  187.       endloop
  188.    else
  189.       Width = ScreenWidth - 9
  190.    endif
  191.    Height = NumElem + 2
  192.    Width = Width + 5
  193.    if Center
  194.       if Row = 0
  195.  
  196.          ;Center window verticaly
  197.  
  198.          Row = ((ScreenHeight - Height) / 2) + 2
  199.       else
  200.  
  201.          ;Center window with X Coordinate
  202.  
  203.          Row = (Row - (Height / 2) + 1)
  204.       endif
  205.       if Col = 0
  206.  
  207.          ;Center window horizonitly
  208.  
  209.          Col = (ScreenWidth - Width) / 2 + 1
  210.       else
  211.  
  212.          ;Center window with Y Coordinate
  213.  
  214.          Col = (Col - (Width / 2) + 1)
  215.       endif
  216.    endif
  217.  
  218.    ;Make Sure Row and Col are within their range
  219.  
  220.    Row = Max(Row,5)
  221.    Row = Min(Row,ScreenHeight - Height - 2)
  222.    Col = Max(Col,2)
  223.    Col = Min(Col,ScreenWidth - Width - 2)
  224.  
  225.    DrawTheBox(Col,Row,Width,Height,Header)
  226.  
  227.      ;Write the menu choices
  228.  
  229.    loop(NumElem - 1)
  230.       if left(Choices[LoopIndex],1) = '─'
  231.          TextColor MenuVertLinesFG MenuBG
  232.          ClearLine 196
  233.          TextColor MenuInsideFG MenuBG
  234.          CapsColor(MenuCapColorFG,MenuBG)
  235.          Writeln
  236.       else
  237.          Writeln(Choices[LoopIndex])
  238.       endif
  239.    endloop
  240.  
  241.    Write Choices[NumElem]
  242.    UseArrows On
  243.    Dispose(Choices)
  244. EndProc
  245.  
  246. ;------ Draw the Box
  247.  
  248. Procedure DrawTheBox (Col,Row,Width,Height,Header)
  249.  
  250.      ;Draw the main window
  251.  
  252.    DoubleLineBox
  253.    InActiveBox SingleLineBox
  254.    BoxInsideColor(MenuInsideFG,MenuBG)
  255.    BoxBorderColor(MenuBorderFG,MenuBG)
  256.    if Header > '' then Header = ' ' + Header + ' '
  257.    BoxHeader = Header
  258.    DrawBox(Col, Row, Width, Height)
  259.  
  260.    if Header > ''
  261.  
  262.       TextColor MenuInsideFG MenuBG
  263.       CapsColor(MenuCapColorFG,MenuBG)
  264.       InverseColor(MenuInverseFG,MenuInverseBG)
  265.       Window(Col + 2, Row + 1, Width - 4, Height - 2)
  266.    else
  267.       CapsColor Black Black
  268.    endif
  269. EndProc
  270.  
  271.